<template>
  <div class="recommend">
    <title-view :label="$t('home.recommend')" :btn="$t('home.seeAll')"></title-view>
    <div class="recommend-list">
      <div class="recommend-item" v-for="(item, index) in data" :key="index" @click="showBookDetail(item)">
        <div class="img-wrapper">
          <img class="img" :src="item.cover">
        </div>
        <div class="content-wrapper">
          <div class="title title-medium" ref="title">{{item.title}}</div>
          <div class="num sub-title" ref="num">{{$t('home.readers').replace('$1', item.readers)}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import TitleView from '@/components/home/title'
import { storeHomeMixin } from '../../utils/mixin'
export default {
  mixins: [storeHomeMixin],
  props: {
    data: Array
  },
  components: {
    TitleView
  },
  mounted() {
    console.log(this.data)
  }
}
</script>

<style lang='scss' scoped>
@import '../../assets/style/global.scss';
.recommend {
  .recommend-list {
      width: 100%;
      padding: 0 px2rem(20);
      @include top;
      box-sizing: border-box;
    .recommend-item {
        flex: 0 0 33.33%;
        width: 33.33%;
        padding: 0 px2rem(5);
        box-sizing: border-box;
      .img-wrapper {
          @include center;
        .img {
            width: 80%;
        }
      }
      .content-wrapper {
          font-size: px2rem(10);
          @include columnCenter;
        .title {
          font-size: px2rem(10);
            text-align: center;
        }
        .num {
          font-size: px2rem(10);
            margin-top: px2rem(5);
        }
      }
    }
  }
}
</style>
